
import 'package:flutter/material.dart';
import 'package:flutter_swiper_view/flutter_swiper_view.dart';
import 'package:get/get.dart';

import '../../../units/httpsClient.dart';
import '../controllers/home_controller.dart';

class SwiperView extends StatelessWidget {
  List<String> imgUrls = [
    'https://picsum.photos/400/300?img=1',
    'https://picsum.photos/400/300?img=2',
    'https://picsum.photos/400/300?img=3',
  ];
  @override
  Widget build(BuildContext context) {
    print(Get.isRegistered<HomeController>());
    final homeController = Get.find<HomeController>();
    final imgs = homeController.swiperList;

    return Swiper(
      itemBuilder:
          (context, index) => Image.network(
            // HttpsClient.replaeUri(imgUrls[index]),
            imgUrls[index],
            fit: BoxFit.fill,
          ),
      itemCount: imgUrls.length,
      autoplay: true,
      // pagination: SwiperPagination(), // 分页指示器
      // control: SwiperControl(), // 左右箭头
    );
  }
}
